
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/templates/FoodSageTemplateUnauthenticated.xhtml">
    
    <ui:define name="main_menu">
        <f:view beforePhase="#{indexManagedBean.initView}" ></f:view>
        <p:menubar model="#{indexManagedBean.touristMainMenuModel}"/>
    </ui:define>
    
    <ui:define name="content">  

        <!-- panel for dividing web page into sections -->
        <p:panel id="panel" header="#{bundle['touristAccount.header.panel']}">  
            <p:messages id="allMessages"/>

            <p:tabView id="tabViewTouristView" dynamic="false">

                <p:tab id="tabTouristAccountInfo" title="#{bundle['myfoodsage.accountinfo.tab']}">
                    <h:panelGrid id="panelGridTouristCreate" columns="3"  cellpadding="5" >
                        <h:outputLabel id="touristAccountTouristUsernameLabel" value ="#{bundle['touristAccount.username.label']}" style="font-weight: bold"/>
                        <p:inputText id="username" value="#{touristRegisterManagedBean.username}" required="true" requiredMessage="#{bundle['touristAccount.username.required']}" >
                            <f:validator validatorId="checkValidEmail" />
                        </p:inputText>
                        <p:message for="username"/>

                        <h:outputLabel id="touristAccountTouristPasswordLabel" value="#{bundle['touristAccount.password.label']}" style="font-weight: bold" />
                        <p:password id="newpassword" value="#{touristRegisterManagedBean.password}" binding="#{pw}" feedback="=true" minLength="6" required="true" requiredMessage="#{bundle['touristAccount.password.required']}" validatorMessage="#{bundle['touristAccount.password.validatorLength']}">
                            <f:validateLength minimum="6" />
                        </p:password>
                        <p:message for="newpassword"/>

                        <h:outputLabel id="touristAccountTouristConfirmPasswordLabel" value="#{bundle['touristAccount.confirmpassword.label']}" style="font-weight: bold"/>
                        <p:password id="confirmpassword" value="#{touristRegisterManagedBean.confirmPassword}" feedback="=true" minLength="6" required="true" requiredMessage="#{bundle['touristAccount.confirmpassword.required']}" >
                            <f:validator validatorId="matchPassword" />
                            <f:attribute name="pw" value="#{pw}" />
                        </p:password>
                        <p:message for="confirmpassword"/>

                        <h:outputLabel id="touristAccountTouristLastnameLabel" value ="#{bundle['touristAccount.lastname.label']}" style="font-weight: bold"/>
                        <p:inputText id="lastname" value="#{touristRegisterManagedBean.lastname}" required="true" requiredMessage="#{bundle['touristAccount.lastname.required']}"/>
                        <p:message for="lastname"/>

                        <h:outputLabel id="touristAccountTouristFirstnameLabel" value="#{bundle['touristAccount.firstname.label']}" style="font-weight: bold"/>
                        <p:inputText id="firstname" value="#{touristRegisterManagedBean.firstname}" required="true" requiredMessage="#{bundle['touristAccount.firstname.required']}"/>
                        <p:message for="firstname"/>


                        <h:outputLabel id="touristAccountTouristGenderLabel" value="#{bundle['touristAccount.gender.label']}" style="font-weight: bold"/>
                        <h:selectOneMenu id="gender" value="#{touristRegisterManagedBean.gender}" required="true" requiredMessage="#{bundle['touristAccount.gender.required']}">
                            <f:selectItems value="#{enumGender.listItems}"/>
                        </h:selectOneMenu>
                        <p:message for="gender"/>

                        <h:outputLabel id="touristAccountTouristBirthdateLabel" value ="#{bundle['touristAccount.birthdate.label']}" style="font-weight: bold" />
                        <p:calendar id="birthdate" value="#{touristRegisterManagedBean.birthdate}" showOn="button" showButtonPanel="true" navigator="true" required="true" requiredMessage="#{bundle['touristAccount.birthdate.required']}" pattern="yyyy-MM-dd" />
                        <p:message for="birthdate"/>

                        <h:outputLabel id="touristAccountTouristCountryLabel" value ="#{bundle['touristAccount.country.label']}" style="font-weight: bold"/>
                        <h:selectOneMenu id="country" value="#{touristRegisterManagedBean.country}" required="true" requiredMessage="#{bundle['touristAccount.country.required']}">
                            <f:selectItems value="#{enumCountry.listItems}"/>
                        </h:selectOneMenu>
                        <p:message for="country"/>

                        <h:outputLabel id="touristAccountTouristLocaleLabel" value ="#{bundle['touristAccount.languagepreferred.label']}" style="font-weight: bold"/>
                        <h:selectOneMenu id="locale" value="#{touristRegisterManagedBean.locale}" required="true" requiredMessage="#{bundle['touristAccount.languagepreferred.required']}">
                            <f:selectItems value="#{enumLanguage.listItems}"/>
                        </h:selectOneMenu>
                        <p:message for="locale"/>

                        <h:outputLabel id="touristAccountTouristEmailSecondaryLabel" value ="#{bundle['touristAccount.emailSecondary.label']}" style="font-weight: bold"/>
                        <p:inputText id="emailSecondary" value="#{touristRegisterManagedBean.emailSecondary}" validatorMessage="#{bundle['touristAccount.username.validatorEmailFormat']}">
                            <f:validator validatorId="checkValidEmail" />
                        </p:inputText>
                        <p:message for="emailSecondary"/>

                        <h:outputLabel id="accountStaffCaptchaLabel" value ="#{bundle['touristAccount.captcha.label']}" style="font-weight: bold" />
                        <p:captcha id="captcha" required="true" requiredMessage="touristAccount.captcha.required" label=" " /> 
                        <p:message for="captcha"/>

                    </h:panelGrid>
                </p:tab>
                
                <p:tab id="tabTouristPersonalPref" title="#{bundle['myfoodsage.personalPref.tab']}">
                    <h:panelGrid columns="9" cellpadding="5">
                        <h:outputLabel id="touristCuisinePrefLabel" value="#{bundle['touristAccount.cuisinePref.label']}" style="font-weight: bold"/>
                        <h:selectManyCheckbox id="cuisinePref" layout="pageDirection" value="#{touristRegisterManagedBean.cuisineTypeList}" converter="cuisineTypeConverter">
                            <f:selectItems value="#{enumCuisineType.listItems}" />
                        </h:selectManyCheckbox>
                        <p:message for="cuisinePref"/>
                        
                        <h:outputLabel value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"/>
                        <h:outputLabel value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"/>
                        <h:outputLabel value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"/>

                        <h:outputLabel id="touristInterestPrefLabel" value="#{bundle['touristAccount.interestPref.label']}" style="font-weight: bold"/>
                        <h:selectManyCheckbox id="interestPref" layout="pageDirection" value="#{touristRegisterManagedBean.interestList}" converter="interestConverter">
                            <f:selectItems value="#{enumInterest.listItems}" />
                        </h:selectManyCheckbox>
                        <p:message for="interestPref"/>
                    </h:panelGrid>
                </p:tab>
                
            </p:tabView>    
                    

            <p:ajaxStatus style="width:16px;height:16px;">
                <f:facet name="start">
                    <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value="" />
                </f:facet>
            </p:ajaxStatus>
            <p:commandButton id="touristAccountRegisterButton" value="#{bundle['touristAccount.register.button']}" update="panel" actionListener="#{touristRegisterManagedBean.registerTourist}" ajax="false" />
            <p:commandButton id="touristAccountResetButton" value="#{bundle['touristAccount.reset.button']}" type="reset"/>
        </p:panel> 

    </ui:define>  
    
</ui:composition>
